-- MyCardAgent
-- Created by chenx 2016.5.13
-- 台湾 mycard 支付代理

module("MyCardAgent", package.seeall);

function init()
    print('MyCardAgent init\n');
end

----------------------
-- mycard购买商品
-- @param sku 商品库存标识
function buyPurchase(sku, price)
    local serverId = getCurrentServerId();
    local account  = getGaming3rdAccount() or "empty3rdAccount";
    local platform = PUBLISH_PLATFORM;

    --print("mycardagent buyPurchase sku: %s, account : %s\n", sku, account);

    price = price or 30;
    -- 通过 mycard 支付购买商品
    callJavaFunc("buyPurchaseViaMyCard", {sku, tostring(price), account, ME.user.rid, serverId, platform},
        "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
end

-- mycard 批量查询商品价格
-- @param sku 商品库存标识
function batchQuerySkuPrice(skuStr, accountStr)

    --print("mycardagent batchQuerySkuPriceVia skuStr: %s, accountStr : %s\n", skuStr, accountStr);

    -- 通过 mycard 支付购买商品
    callJavaFunc("batchQuerySkuPriceViaMyCard", {skuStr, accountStr}, "(Ljava/lang/String;Ljava/lang/String;)V");
end
